#include "soc_sleep.h"
#include "cms8s6990.h"

/// @brief 
/// @param ms 最大 8000 ms
void SOC_SleepConfigTimeoutMode(uint32_t ms)
{
    if(ms < 2)
        ms = 2;
    if(ms > 8000)
        ms = 8000;

    SYS_ConfigWUTCLK(WUT_CLK_DIV_256);   //Fwut = LSI(125Khz)/32  [256us][333us]
    SYS_ConfigWUTTime((ms / 2.048) + 0.5);
    SYS_EnableWakeUpTrig();
}

void SOC_SleepConfigGpioITMode()
{
}

void SOC_SleepEnter()
{
    SYS_EnableWakeUp();
    SYS_EnterStop();
}